<template>
  <div class = "config-nav-bar">
    <div class = "nav-bar-left">
      <span><user-icon icon = "flow"/>流水线</span>
    </div>
    <div class = "nav-bar-right">
      <el-button @click = "execLine" link title = "" type = "primary">
        <user-icon icon = "fa-circle-play"/>
        <el-tooltip content = "执行">执行</el-tooltip>
      </el-button>
    </div>
  </div>
  <div style = "height: 60px;"></div>
  <el-tabs @tab-click = "handleClick(tab, event)" type = "card" v-model = "activeName">
    <el-tab-pane label = "执行记录" name = "first">
      <instance-item-detail></instance-item-detail>
    </el-tab-pane>
    <el-tab-pane label = "修改历史" name = "second">修改历史</el-tab-pane>
    <el-tab-pane label = "回滚记录" name = "third">回滚记录</el-tab-pane>
  </el-tabs>

</template>
<style lang = "scss" scoped>
.config-nav-bar {
  position: fixed;
  width: 100%;
  height: 60px;
  display: flex;
  z-index: 999999;
  flex-direction: row;
  background: #f1f2f3;
  margin-left: -20px;
  margin-top: -12px;
  align-items: center;

  .nav-bar-left {
    width: 55%;

    span {
      margin-left: 15px;
    }
  }

  .nav-bar-right {
    display: flex;
    position: relative;
    right: 15px;
    flex-direction: row;
  }
}
</style>
<script>

import {ref} from "vue";
import {common} from "../../api/common";
import InstanceItemDetail from "./InstanceItemDetail";

export default {
  name: "ContinusInstanceExecRecord",
  components: {InstanceItemDetail},
  mixins: [common],
  setup() {
    return {}
  },
  data() {
    const loadByPageUrl = ref("/devops-continus/continus/continusInstance/pageList");
    const mergeUrl = ref("/devops-continus/continus/continusInstance/merge");
    const mergeDraftUrl = ref("/devops-continus/continus/continusInstance/mergeDraft");
    const batchMergeUrl = ref("/devops-continus/continus/continusInstance/mergeBatch");
    const batchMergeDraftUrl = ref("/devops-continus/continus/continusInstance/mergeBatchDraft");
    const loadByIdUrl = ref("/devops-continus/continus/continusInstance/getById");
    const deleteUrl = ref("/devops-continus/continus/continusInstance/batchDeleteByIdLogic");
    const exportAllUrl = ref("/devops-continus/continus/continusInstance/exportData");
    const downloadTemplateUrl = ref("/devops-continus/continus/continusInstance/downloadTemplate");
    const uploadUrl = ref("/devops-continus/continus/continusInstance/importData");
    const userConditionUrl = ref("/devops-continus/continus/continusInstance/getAllByCondition");
    const primaryKey = "idContinusInst";
    return {
      loadByPageUrl,
      mergeUrl,
      mergeDraftUrl,
      batchMergeUrl,
      batchMergeDraftUrl,
      loadByIdUrl,
      deleteUrl,
      exportAllUrl,
      downloadTemplateUrl,
      uploadUrl,
      userConditionUrl,
      primaryKey,
      activeName: "first"
    }
  },
  methods: {
    dataFormat(row, column, cellValue, index) {
      cellValue = this.commonDataFormat(row, column, cellValue, index);
      return cellValue;
    },
    /**
     * 初始化数据
     */
    init: function () {
      this.dataList = [];
      this.selectData = [];
      this.loadByPage(this.currentPage, this.pageSize);
      this.loadPermissionResources();
      this.commonSelectData("cts_continus_instance");
    },

    parseSearchData: function () {
      let data = this.searchForm;
      let arr = [];
      if (data.statusName) {
        arr.push({
          propertyName: "statusName",
          value: data.statusName,
          operation: "lk"
        });
      }
      if (data.createdDate) {
        arr.push({
          propertyName: "createdDate",
          value: data.createdDate,
          operation: "bt"
        });
      }
      return arr;
    }
  },
  created() {
    // this.init();
  }
}
</script>